-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove allocations during bass device sync polling operation #6124
Conversation
e8bce92
to
e51e7f9
Compare
e51e7f9
to
7ce8d47
Compare
// Can't use `MoveToImmutable` here as we don't provide accurate capacity. | ||
return new KeyCombination(keys.ToImmutableList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this change is doing in here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fixed a couple of incorrect calls on array building. Check underlying implementation for reasoning (one allocates, other doesn't).
See 7ce8d47.
I can move to another PR if you want, but it was one line change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I meant to revert this case. As per the comment, we can't use MoveTo
due to capacity not being set (a hidden gotcha).
This will still allocate as the call I incorrectly "reverted" to is synonymous with the original.
@@ -341,7 +341,7 @@ private static IEnumerable<Display> getSDLDisplays() | |||
Logger.Log($"Failed to retrieve SDL display at index ({i})", level: LogLevel.Error); | |||
} | |||
|
|||
return builder.ToImmutable(); | |||
return builder.MoveToImmutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...or this one either, for that matter...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
Minor gains because this is just a one second poll, but is what it is.
Also fixed a couple of incorrect calls on array building. Check underlying implementation for reasoning (one allocates, other doesn't).